#ifndef MINIRACES_HPP_INCLUDED
#define MINIRACES_HPP_INCLUDED

#include <list>

#include <SFML/Graphics.hpp>

#include "../game_state.hpp"
#include "../singleton.hpp"

struct Car {
	sf::Sprite sprite;
	float speed;
	unsigned int checkPoint;
};

struct CheckPoint {
	int x, y;
	int w, h;
	
};

class MiniRaces: public GameState, public Singleton<MiniRaces> {
	friend class Singleton<MiniRaces>;
	public:
		void init(Engine *engine);
		void cleanup();
		
		void pause();
		void resume();
		
		void processEvent(Engine *engine, PlayerEvent& event);
		void update(Engine *engine);
		void draw(Engine *engine);
		
		sf::Sprite bottom, road, top;
		std::map<int, Car> cars;
		int remainingCars;
		bool quit;
		float quitTime;
		
		std::vector<CheckPoint> checkPoints;
		std::list<ScoreString> scoreStrings;
		
		sf::Clock clock;
	protected:
		void addScore(Engine *engine, int player, int score);
		
		MiniRaces();
		~MiniRaces();
};

#endif // MINIRACES_HPP_INCLUDED
